package com.mdd.admin.controller;

import com.mdd.admin.service.IBusinessUserService;
import com.mdd.admin.validate.BusinessUserSearchValidate;
import com.mdd.admin.validate.commons.PageValidate;
import com.mdd.admin.vo.BusinessUserListedVo;
import com.mdd.common.core.AjaxResult;
import com.mdd.common.core.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("api/business")
@Api(tags = "总台账号管理")
public class BusinessUserController {

    @Resource
    IBusinessUserService iBusinessUserService;

    @GetMapping("/list")
    @ApiOperation(value="总台账号列表")
    public AjaxResult<PageResult<BusinessUserListedVo>> list(@Validated PageValidate pageValidate,
                                                     @Validated BusinessUserSearchValidate searchValidate) {
        PageResult<BusinessUserListedVo> list = iBusinessUserService.list(pageValidate, searchValidate);
        return AjaxResult.success(list);
    }

    @GetMapping("/all/business")
    @ApiOperation(value="获取所有销售")
    public AjaxResult<List<BusinessUserListedVo>> allBusiness() {
        List<BusinessUserListedVo> list = iBusinessUserService.allBusiness();
        return AjaxResult.success(list);
    }

}
